#!/usr/bin/env r

## script to start the doRedis workers

## usage: 'startWorkers.r n queue host'

trim <- function(line) gsub("(^ +)|( +$)", "", line)

workersNumber <- as.numeric(trim(argv[1]))
queueString <- as.character(trim(argv[2]))
hostString <-  as.character(trim(argv[3]))

lib.loc <- "/home/ubuntu/R/library"
require( doRedis, lib.loc )

# start the workers
startLocalWorkers(n=workersNumber, queue=queueString, host = hostString)

